Carousel Template with Link Tracking
The Carousel messaging template now supports link tracking, allowing you to track user interactions with URL buttons in carousel cards. This enables detailed analytics on the URLs clicked by users. You must pass the 'longUrls' in the metadata field for which you want to track the clicks.
The creation of 'ShortURLs' will be done at Sinch’s end and the 'ShortURLs' will be passed as the parameter.
Overview
trackingCta: This is an optional addition to themetadataobject, which allows link tracking for URL buttons in carousel messages.targets: Must pass list of URLs that will be tracked. These URLs are associated with the URL buttons in your carousel cards.
Key Features
- Link tracking: Only URL buttons in carousel cards support link tracking.
- Multiple Cards: Each carousel message can contain multiple cards, and each card can have up to 2 URL buttons for link tracking.
When to Use
- Track user engagement with different products or services listed in your carousel.
- Measure the success of marketing campaigns through click data.
Example of Payload with Single Link Tracking
Here’s how you can include trackingCta in your carousel message payload:
{
"messaging_product": "whatsapp",
"recipient_type": "individual",
"to": "<recipient_mobile_number>",
"type": "template",
"template": {
"name": "<template_name>",
"language": {
"code": "<template_language_code>"
},
"components": [
{
"type": "BODY",
"parameters": [
{
"type": "TEXT",
"text": "20OFF"
}
]
},
{
"type": "CAROUSEL",
"cards": [
{
"card_index": 0,
"components": [
{
"type": "HEADER",
"parameters": [
{
"type": "IMAGE",
"image": {
"id": "1323649805780"
}
}
]
},
{
"type": "BODY",
"parameters": [
{
"type": "text",
"text": "20OFF"
}
]
},
{
"type": "BUTTON",
"sub_type": "URL",
"index": "0",
"parameters": [
{
"type": "PAYLOAD",
"payload": "59NqSd"
}
]
}
]
},{
"card_index": 1,
"components": [
{
"type": "HEADER",
"parameters": [
{
"type": "IMAGE",
"image": {
"id": "1323649805780"
}
}
]
},
{
"type": "BODY",
"parameters": [
{
"type": "text",
"text": "20OFF"
}
]
},
{
"type": "BUTTON",
"sub_type": "URL",
"index": "0",
"parameters": [
{
"type": "PAYLOAD",
"payload": "59NqSd"
}
]
}
]
},{
"card_index": 2,
"components": [
{
"type": "HEADER",
"parameters": [
{
"type": "IMAGE",
"image": {
"id": "1323649805780"
}
}
]
},
{
"type": "BODY",
"parameters": [
{
"type": "text",
"text": "20OFF"
}
]
},
{
"type": "BUTTON",
"sub_type": "URL",
"index": "0",
"parameters": [
{
"type": "PAYLOAD",
"payload": "59NqSd"
}
]
}
]
}// You can add more cards maximum upto 10
]
}
]
},
"metadata": {
"trackingCta": {
"targets": [
"longURL1", // this url will be mapped with the button having sub_type as "URL" in 1st card
"longURL2", // this url will be mapped with the button having sub_type as "URL" in 2nd card
"longURL3", // this url will be mapped with the button having sub_type as "URL" in 3rd card
.
.
.
"longURL10" // this url will be mapped with the button having sub_type as "URL" in 10th card
], //<tracking_urls>
"tags": {
"appID": "<app_id>",
"MSISDN": "<recipient_mobile_number>",
"campaign": "campaign_name",
"template": "template_name",
"key1": "value2"
}
}
}
}
Example of Payload with Multiple Link Tracking
Here’s how you can include trackingCta in your carousel message payload:
{
"messaging_product": "whatsapp",
"recipient_type": "individual",
"to": "<recipient_mobile_number>",
"type": "template",
"template": {
"name": "<template_name>",
"language": {
"code": "<template_language_code>"
},
"components": [
{
"type": "BODY",
"parameters": [
{
"type": "TEXT",
"text": "20OFF"
}
]
},
{
"type": "CAROUSEL",
"cards": [
{
"card_index": 0,
"components": [
{
"type": "HEADER",
"parameters": [
{
"type": "IMAGE",
"image": {
"id": "1323649805780"
}
}
]
},
{
"type": "BODY",
"parameters": [
{
"type": "text",
"text": "20OFF"
}
]
},
{
"type": "BUTTON",
"sub_type": "URL",
"index": "0",
"parameters": [
{
"type": "PAYLOAD",
"payload": "59NqSd"
}
]
},
{
"type": "BUTTON",
"sub_type": "URL",
"index": "1",
"parameters": [
{
"type": "PAYLOAD",
"payload": "59NqSd"
}
]
} // Maximum upto 2 button having sub_type as URL can be given for link tracking
]
},{
"card_index": 1,
"components": [
{
"type": "HEADER",
"parameters": [
{
"type": "IMAGE",
"image": {
"id": "1323649805780"
}
}
]
},
{
"type": "BODY",
"parameters": [
{
"type": "text",
"text": "20OFF"
}
]
},
{
"type": "BUTTON",
"sub_type": "URL",
"index": "0",
"parameters": [
{
"type": "PAYLOAD",
"payload": "59NqSd"
}
]
},
{
"type": "BUTTON",
"sub_type": "URL",
"index": "1",
"parameters": [
{
"type": "PAYLOAD",
"payload": "59NqSd"
}
]
} // Maximum upto 2 button having sub_type as URL can be given for link tracking
]
} // You can add more cards maximum upto 10
]
}
]
},
"metadata": {
"trackingCta": {
"targets": [
"longURL1", // this url will be mapped with the button having sub_type as "URL" which is coming first in indexing in 1st card
"longURL2", // this url will be mapped with the button having sub_type as "URL" which is coming second in indexing in 1st card
"longURL3", // this url will be mapped with the button having sub_type as "URL" which is coming first in indexing in 2nd card
"longURL4", // this url will be mapped with the button having sub_type as "URL" which is coming second in indexing in 2nd card
.
.
.
"longURL19", // this url will be mapped with the button having sub_type as "URL" which is coming first in indexing in 10th card
"longURL20" // this url will be mapped with the button having sub_type as "URL" which is coming second in indexing in 10th card
], //<tracking_urls>
"tags": {
"appID": "<app_id>",
"MSISDN": "<recipient_mobile_number>",
"campaign": "campaign_name",
"template": "template_name",
"key1": "value2"
}
}
}
}
Parameters
| Placeholder | Description | Sample Value |
|---|---|---|
template_language_code Enum | Required Language and locale code of the template to be sent in the template message. | En_US |
template_name String | Required Name of the template to be sent in the template message. | Template_1 |
recipient_mobile_number String | Required Phone number of customer to whom the template message should be sent to. | 7890XXXXXX |
Meta Data Object
| Placeholder | Description | Sample Value |
|---|---|---|
<app_id> String | Required ID passed by the enterprise | wenszx12 |
<campaign_name> String | Required Name of the campaign | SummerSale2025 |
<tracking_urls> | Required if sending tracking urls. Array of Urls to be tracked(upto 2) | ["https://www.ex.com","https://www.ez.com"] |
HEADER
- Each card can have header of any Media type like image, video, document etc.
- For more information refer 'Carousel Template' section.*
BODY
- Each card can have a body having information .
- For more information refer 'Carousel Template' section.*
BUTTON
- Each card can have multiple buttons of different type like url, quick reply etc.
- For
trackingupload a button of sub_type :URLalong with thelongURLintargetsArray insidetrackingCTaas below :{"targets": ["longURL"]} - If the card have multiple button with sub_type:
URL, fortrackingupload twolongURLintargetsArray insidetrackingCTaas below :{"targets": ["longURL1","longURL2"]} - For more information refer 'Carousel Template' section.*